package com.wu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wu.pojo.ArticleClassify;
import com.wu.pojo.Classify;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author: 吴磊
 * @program: blog
 * @create: 2021-04-19 20:41
 */
@Mapper
public interface ArticleClassifyMapper extends BaseMapper<ArticleClassify> {

    /**
     * 根据文章ID获取对应的类别
     *
     * @param articleId
     * @return
     */
    Classify getClassifyByArticle(@Param("articleId") String articleId);

    /**
     * 根据文章分类返回对应的文章ID集合
     *
     * @param classifyName
     * @return
     */
    List<String> getArticleIdByClassify(@Param("classifyName") String classifyName);

    /**
     * 插入文章分类
     *
     * @param articleId
     * @param classifyId
     * @return
     */
    Integer insert(@Param("articleId") String articleId,
                   @Param("classifyId") String classifyId);


    /**
     * 修改文章分类
     *
     * @param articleId
     * @param classifyId
     * @return
     */
    Integer update(@Param("articleId") String articleId,
                   @Param("classifyId") String classifyId);

    /**
     * 通过文章Id删除文章标签
     *
     * @param articleId
     * @return
     */
    Integer deleteByArticleId(@Param("articleId") String articleId);
}
